Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/RegistrationGameStyles #85

Open
wants to merge 49 commits into
base: develop
Choose a base branch
from

Conversation

viniciusmontibeller
Copy link

Adicionados funções referentes a tarefa de cadastro de estilos de jogo referente a tarefa #107 do Taiga

  • Funcionalidade de seleção de checkbox com validação.
  • Integrado com salvamento em local storage do formulário
  • Reutilizados componentes ja disponiveis

Adicional

  • Feito um skeleton component genérico que pode ser embutido no projeto

Copy link

netlify bot commented Jun 20, 2024

Deploy Preview for temvagamestre ready!

Name Link
🔨 Latest commit a866dbc
🔍 Latest deploy log https://app.netlify.com/sites/temvagamestre/deploys/66875438cca7010008eb851c
😎 Deploy Preview https://deploy-preview-85--temvagamestre.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

},
})

function onSubmit(data: FormGameStylesType) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nao entendi essa função, porque ela ta aqui?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nao entendi essa função, porque ela ta aqui?

Creio que isso tenha sido feito enquanto eu estava construindo ainda. O final tem tudo isso, só o componente com o seu custom hook, e o formulário relacionado.

<CheckboxPrimitive.Root
ref={ref}
className={cn(
"peer h-4 w-4 shrink-0 rounded-sm border border-slate-900 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=checked]:text-slate-50 dark:border-slate-50 dark:ring-offset-slate-950 dark:focus-visible:ring-slate-300 dark:data-[state=checked]:bg-slate-50 dark:data-[state=checked]:text-slate-900",
Copy link
Member

@htamagnus htamagnus Jul 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Como foi bastante alteração de estilo, uma dica pra ficar mais fácil a manutenção é separar/dividir tudo isso, como por exemplo:

const baseClasses = "peer h-4 w-4 shrink-0 rounded-sm border ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:ring-offset-slate-950";
const stateClasses = "data-[state=checked]:bg-slate-900 data-[state=checked]:text-slate-50 dark:data-[state=checked]:bg-slate-50 dark:data-[state=checked]:text-slate-900";
const borderClasses = "border-slate-900 dark:border-slate-50";
const focusClasses = "focus-visible:ring-slate-950 dark:focus-visible:ring-slate-300";

className={cn(
  baseClasses,
  borderClasses,
  focusClasses,
  stateClasses,
  className
)}

<Form {...form}>
<div>
<FormAditionalText className='text-center'>
Olá! Para aprimorarmos sua experiência no TVM, por favor, responda
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essas partes de textos estáticos poderia ser colocada em um json, facilita a manutenção.

Algo como:

{ "formGameStyles": { "additionalText": "Olá! Para aprimorarmos sua experiência no TVM, por favor, responda algumas perguntas.", "title": "Escolha o estilo de jogo que mais se alinha com seus interesses." } }

isLoading,
error,
} = useFetchData<GameStyle[]>(
'https://tem-vaga-mestre-api-nnf7bytugq-uc.a.run.app/rpg-style',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passar isso pra env, pra melhor manutenção, flexibilidade e segurança
process.env.REACT_APP_RPG_STYLE_API_URL

const response = await fetch(`https://tem-vaga-mestre-api-nnf7bytugq-uc.a.run.app/user/check-username/${username}`)
return response.status === 200 ? true : false
const response = await fetch(
`https://tem-vaga-mestre-api-nnf7bytugq-uc.a.run.app/user/check-username/${username}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passar pra env

@viniciusmontibeller viniciusmontibeller changed the base branch from homolog to develop July 5, 2024 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants